import java.util.Random;
import java.util.Scanner;
public class Code9_25 {
    public static int[] get(int n){
        int arr[] = new int[n];
        Scanner scanner = new Scanner(System.in);
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            System.out.println("请输入评分：");
            int grad = scanner.nextInt();
            arr[i] = grad;
        }
        return arr;
    }
        //求掉最高分与最低分
    public static double put(int[] arr) {
        double sum = 0;
        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - 1 - i; j++) {
                if (arr[j] > arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }
            }
        }
        for (int i = 1; i < arr.length - 1; i++) {
            sum += arr[i];
        }
        return sum/(arr.length-2);
    }
    public static void main(String[] args) {
        System.out.println("请输入多少评委打分：");
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        System.out.println(put(get(n)));
    }
//模拟生成随机验证码
    public static String mun(int n){
        String str = "";
        Random random = new Random();
        for (int i = 0; i < n; i++) {
            int ch = random.nextInt(3);
            if (ch == 0){
                str += random.nextInt(10);
            }else if(ch == 1){
                str += (char)(random.nextInt(26)+65);
            }else {
                str += (char)(random.nextInt(26)+97);
            }
            str+=" ";
        }
        return str;
    }
    public static void main1(String[] args) {
        //随机生成数字或者字母
        System.out.println(mun(5));
    }
}
